package com.demo.solution;

import java.io.ByteArrayOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;

public class Solution3 {
    public static void main(String[] args) throws IOException {

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(1024);

        FilterOutputStream filterOutputStream = new FilterOutputStream(byteArrayOutputStream);

        filterOutputStream.write("abc".getBytes());

        filterOutputStream.close();

        System.out.println(filterOutputStream.toString());
        System.out.println(byteArrayOutputStream.toString());

    }
}